@extends('admin.main')

@section('content')
<div class="wrapper wrapper-content">
    <div class="ibox">
        <div class="ibox-title">
            <h5>反馈列表</h5>
        </div>
        <div class="ibox-content">
            <!-- <div class="hr-line-dashed"></div> -->
            <div id="tblDataList" class="tab-pane active">
                <table class="table table-striped table-bordered">
                    <thead>
                    <tr>
                        <th>id</th>
                        <th>反馈用户</th>
                        <th>反馈内心</th>
                        <th>内容</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($rows as $k=>$v)
                    <tr data-id="{{$v->id}}" >
                        <td>{{($rows->currentPage()-1) * $rows->perPage() + ($k+1)}}</td>
                        <td>{{$v->user->nickname}}</td>
                        <td>{{$v->type}}</td>
                        <td>{{$v->content}}</td>
                        <td>
                            <a href="javascript:;" class="btn btn-danger btn-sm btn-del">
                                <i class="fa fa-trash-o"></i>删除
                            </a>
                        </td>
                    </tr>
                    @endforeach
                    </tbody>
                </table>
                <div class="text-center " id='pagination'>
                    {{$rows->links()}}
                </div>
            </div>
        </div>
    </div>
</div>

@endsection

@section('pageheader')
@endsection
@section('pagescript')
<script>
    $("#side-menu li[rel='feedback']").addClass("active");
    var filter = {page:1,status:0};
    $(function () {
        $("body").on("click",".btn-del",function(){
            var that = $(this).parents('tr').eq(0)
            var id = that.attr('data-id');
            layer.confirm('确定删除该记录且不可恢复？', {
                btn: ['确定','取消'] //按钮
            }, function(){
                $.post('/admin/feedback/delete',{'id':id},function(data){
                    layer.msg('删除成功');
                    that.remove();
                }).fail(failure);
            }, function(){
                layer.closeAll();
            });
        })
    })

</script>
@endsection
